using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BlackHoleSkill : Skill
{
    [SerializeField] private int amountAttackts;
    [SerializeField] private float cloneCoolDown;
    [Space]
    [SerializeField] private GameObject blackHolePrefab;
    [SerializeField] private float maxSize;
    [SerializeField] private float growSpeed;
    [SerializeField] private float shrinkSpeed;
    [SerializeField] private float blackHoleDuration;
    BlackHoleSkillControler currentBlackHoleControler;
    public override bool CanUseSkill()
    {
        
        return base.CanUseSkill();


    }

    public override void UseSkill()
    {
        base.UseSkill();
        GameObject newGameObjecta = Instantiate(blackHolePrefab, player.transform.position,Quaternion.identity);
        currentBlackHoleControler = newGameObjecta.GetComponent<BlackHoleSkillControler>();
        currentBlackHoleControler.SetUpBlackHole(maxSize, growSpeed, shrinkSpeed, amountAttackts, cloneCoolDown,blackHoleDuration);
    }

    protected override void Start()
    {
        base.Start();
    }

    protected override void Update()
    {
        base.Update();
    }
    public bool BlackHoleFinished()
    {
        if(!currentBlackHoleControler)
        {
            return false;
        }
        if (currentBlackHoleControler.playerCanExitState)
        {
            currentBlackHoleControler = null;
            return true;
        }
        return false; 
    }
}
